import buildingList from '../src/data/house/fang_house.json'
import sandList from '../src/data/house/fang_house_sand.json'
export default {
    // 楼盘列表
    "GET /getbuildingList":buildingList,
    // 游客搜索
    "GET /getbuildingListShai":(req:any,res:any)=>{
        const { search } = req.query;
        if(search)
        {
            const arr = buildingList.data.filter((item:any)=>{
                return item.title.includes(search)
            })
             res.send(arr)
        }
        else 
        {
            res.send(buildingList.data)
        }   
    },
    // 根据楼盘id获取的详情信息
    "GET /getbuildingDetail":(req:any,res:any)=>{
        const {id} = req.query;
        const arr = buildingList.data.find((item)=>{
            return item.id == id;
        })
        res.send(arr)
        // res.send('1234567')
    },
    // 楼盘 沙盘数据
    "GET /getsandList":sandList,
}